package com.t235.gc.order.service;

import com.t235.gc.dao.HomeRecyclingDetailOrderDao;
import com.t235.gc.dao.HomeRecyclingOrderDao;
import com.t235.gc.entity.HomeRecyclingOrder;
import com.t235.gc.vo.HomeRecyclingOrderVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HomeRecyclingOrderService {
    @Resource
    private HomeRecyclingOrderDao homeRecyclingOrderDao;
    @Resource
    private HomeRecyclingDetailOrderDao homeRecyclingDetailOrderDao;

    public List<HomeRecyclingOrder> getList(HomeRecyclingOrderVo vo){
        return homeRecyclingOrderDao.getList(vo);
    }
    @Transactional
    public Integer del(String orderid){
        if(homeRecyclingDetailOrderDao.deleteByOrderId(Long.parseLong(orderid))>0){
            if(homeRecyclingOrderDao.deleteById(Long.parseLong(orderid))>0){
                return 1;
            }
        }
        return -1;
    }
}